<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tit</title>
    <style>
        *{
            margin: 0 auto;
            text-align: center;
        }
    </style>
    <script>
        window.onload = function(){
        };
        var triangle = function () {
           var i=1;
           while (i<=10){
               var j=1;
               while (j<=i){
                   document.write('*');
                   j++;
               }
               document.write('<br/>');
                   i++;
           }
        };
        var rectangle = function () {
            var i= 1;
            while (i<=4){
                document.write('**********');
                document.write('<br/>');
                i++;
            }
        };

        var draw  = function () {
            var result = prompt('请输入一个你需要的图形[a:三角形;b:矩形;c：菱形;]');
            switch (result) {
                case 'a':
                    triangle();
                    break;
                case 'b':
                    rectangle();
                    break;
                case 'c':
                    rhombus();
                    break;
                default:
                    draw();
                    break;
            }
        };
        draw()
    </script>

</head>
<body>

</body>
</html>
